package Log;

import java.text.SimpleDateFormat;
import java.util.Date;

/*
* 日志打实现印类
* */
public class ConsoleLog implements ISysLog{
    SimpleDateFormat sdf = new SimpleDateFormat("h:mm a");//12:08 PM

    @Override
    public void info(String msg) {
        //1.封装日志对象
        String log = new Log(msg,INFO,sdf.format(new Date())).toString();
        //2.打印日志数据到控制台
        System.out.println(log);
    }

    @Override
    public void warn(String msg) {
        //1.封装日志对象
        String log = new Log(msg,WARN,sdf.format(new Date())).toString();

        //2.打印日志数据到控制台
        System.out.println(log);

    }

    @Override
    public void error(String msg) {
        //1.封装日志对象
        String log = new Log(msg,ERROR,sdf.format(new Date())).toString();

        //2.打印日志数据到控制台
        System.out.println(log);

    }
}
